/*
 * Copyright 2025 The JA-SIG Collaborative. All rights reserved. distributed with this file and
 * available online at
 */
package com.lap.auth.adapter.driving.persistence.dept;

import com.lap.auth.adapter.driving.persistence.dept.po.DeptPo;
import com.lap.auth.domain.dept.Dept;
import com.lap.auth.domain.dept.valueobject.StatusType;
import com.lap.framework.tools.EnumUtil;
import java.util.List;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

@Mapper(componentModel = "spring")
public interface DeptConverter {

  @Mapping(target = "event", ignore = true)
  Dept toDomain(DeptPo deptPo);

  List<Dept> toDomains(List<DeptPo> list);

  DeptPo toPo(Dept dept);

  List<DeptPo> toPoList(List<Dept> list);

  default StatusType codeToStatus(Integer code) {
    return EnumUtil.fromCode(StatusType.class, code);
  }

  default Integer statusToCode(StatusType status) {
    return status.getCode();
  }
}
